export const extend = Object.assign;

//如何判断一个对象是object，不为null，同时typeof 操作后的值是 object
export const isObject = (value) => {
    return value !== null && typeof value === 'object'
}

export const hasChanged = (value, newValue) => {
    return !Object.is(value, newValue);
}

export const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);

// 首字母大写函数
export const capitalize = (str: string) => {
    return str.charAt(0).toUpperCase() + str.slice(1);
}

export const camelize = (str: string) => {
    return str.replace(/-(\w)/g, (_, c: string) => {
        return c ? c.toUpperCase() : "";
    })
}

//   获得要处理的key
export const toHandlerKey = (str: string) => {
    return str ? "on" + capitalize(str) : ""
}


export const EMPTY_OBJ = {};